package com.example.springbootschedule.job;

import com.example.springbootschedule.common.annotation.RedisJobLock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Slf4j
@Component
public class AspectJob {

    @Scheduled(cron = "0/10 * * * * ?")
    @RedisJobLock(lockKey = "aspectjob1", expireTime = 11)
    public void exec1() {
        log.info("aspectjob1 取得锁开始执行！！！！{}", LocalDateTime.now());
    }

    @Scheduled(cron = "0/10 * * * * ?")
    @RedisJobLock(lockKey = "aspectjob2", expireTime = 11)
    public void exec2() {
        log.info("aspectjob2 取得锁开始执行！！！！{}", LocalDateTime.now());
    }

}
